package com.jml.json;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;

public class NoObjectToJson {

	public static void main(String[] args) {
		JSONObject root = new JSONObject();
		root.put("id", "01");
		root.put("name", "张三");
		JSONArray arrayList = new JSONArray();
		JSONObject object1 = new JSONObject();
		object1.put("itemId", "20");
		object1.put("itemName", "jml");
		JSONObject object2 = new JSONObject();
		object2.put("itemId", "30");
		object2.put("itemName", "jml001");
		arrayList.add(object1);
		arrayList.add(object2);
		root.put("items", arrayList);
		System.out.println(root.toJSONString());
	}

}
